// cardCollectionOfOxYearPack/components/drawingCard/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    imgSrc: {
      type: String,
      value: ''
    },
    imgName: {
      type: String,
      value: ''
    }
  },
  lifetimes: {
    attached() {
      this.cardAni()
      // this.textAni()
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    cardAniData: null,
    textAniData: null,
    // imgSrc: 'https://cdn.pixabay.com/photo/2020/10/26/08/58/maple-5686711_960_720.jpg'
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 兼容性似乎不大好, 真机无效, 改用css3
    cardAni() {
      let animation = wx.createAnimation({})
      animation.rotateY(720).opacity(1).scale(10,10).step({duration: 4000, timingFunction: 'ease'})
      // animation.rotateZ(720).opacity(1).scale(10,10).step({duration: 5000, timingFunction: 'ease'})
      this.setData({cardAniData: animation.export()})
    },
    textAni() {
      let animation = wx.createAnimation({})
      animation.opacity(1).step({duration: 4000, timingFunction: 'linear'})
      this.setData({textAniData: animation.export()})
    },
    closeDrawingCard() {
      this.triggerEvent('hiddenDrawingCard')
    }
  }
})
